﻿using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Micro.Core.Options
{
    /// <summary>
    /// <see cref="IConfiguration"/>扩展方法
    /// </summary>
    public static class ConfigurationExtensions
    {
        /// <summary>
        /// 从<see cref="IConfiguration"/>创建<see cref="OsharpOptions"/>
        /// </summary>
        public static MicroOptions GetMicroOptions(this IConfiguration configuration)
        {
            MicroOptions options = new MicroOptions();
            configuration.Bind(options);
            return options;
        }
    }
}
